/**
 * VUEshop
 * ============================================================================
 * * 版权所有 2015-2027 深圳搜豹网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.vueshop.com.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: soubao-java 2020-07-22 $
 */<template>
 <div>
     <div>
      <div class="fixed-bar">
          <div class="item-title"><router-link class="back" :to="{name:'coupons'}" title="返回列表"><i class="fa fa-arrow-circle-o-left"></i></router-link>
              <div class="subject">
                  <h3>店铺代金券 - 编辑代金券</h3>
                  <h5>查看/编辑商家发布的代金券</h5>
              </div>
          </div>
      </div>
      <form :model="form" class="form-horizontal" id="handleposition" method="post">
          <div class="ncap-form-default">
              <dl class="row">
                  <dt class="tit">
                      <label>店铺名称</label>
                  </dt>
                  <dd class="opt">
                      <input v-model="form.store_name" type="text" name="title" id="title" value="" class="input-txt">
                  </dd>
              </dl>
              <dl class="row">
                  <dt class="tit">
                      <label>代金券名称</label>
                  </dt>
                  <dd class="opt">
                      <input v-model="form.name" type="text" name="title" id="title" value="" class="input-txt">
                  </dd>
              </dl>
              <dl class="row">
                  <dt class="tit">
                      <label>优惠券类型</label>
                  </dt>
                  <dd class="opt">
					  	<el-input v-if="form.type == 0" value="下单赠送"></el-input>
						<el-input v-if="form.type == 1" value="按用户发放"></el-input>
						<el-input v-if="form.type == 2" value="免费领取"></el-input>
						<el-input v-if="form.type == 3" value="线下发放"></el-input>
                  </dd>
              </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>有效期</label>
			      </dt>
			      <dd class="opt">
			          <!-- <input v-model="form.use_end_time" type="text" id="price" name="price" value="" class="input-txt"> -->
					  <el-input v-model="form.use_end_time_desc"></el-input>
			      </dd>
			  </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>面额</label>
			      </dt>
			      <dd class="opt">
			          <input v-model="form.money" type="text" id="price" name="price" value="" class="input-txt">
			      </dd>
			  </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>可发放总数</label>
			      </dt>
			      <dd class="opt">
			          <input v-model="form.createnum" type="text" id="price" name="price" value="" class="input-txt">
			      </dd>
			  </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>消费金额</label>
			      </dt>
			      <dd class="opt">
			          <input v-model="form.condition" type="text" id="price" name="price" value="" class="input-txt">
			      </dd>
			  </dl>
              <dl class="row">
                  <dt class="tit">
                      <label>代金券描述</label>
                  </dt>
                  <dd class="opt">
                      <textarea v-model="form.coupon_info" placeholder="" name="description" rows="6" class="tarea"></textarea>
                  </dd>
              </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>已领取 </label>
			      </dt>
			      <dd class="opt">
			          <input v-model="form.send_num" type="text" id="price" name="price" value="" class="input-txt">
			      </dd>
			  </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>已使用</label>
			      </dt>
			      <dd class="opt">
			          <input v-model="form.use_num" type="text" id="price" name="price" value="" class="input-txt">
			      </dd>
			  </dl>
			  <dl class="row">
			      <dt class="tit">
			          <label>状态</label>
			      </dt>
			      <dd class="opt">
					  <el-input v-if="form.status == 1" value="有效"></el-input>
					  <el-input v-if="form.status == 2" value="无效"></el-input>
			      </dd>
			  </dl>
                      </div>
      </form>
     </div>
 </div>
</template>

<script>
	import {
		getStoreCoupon
	} from "@/utils/api";
	export default {
			data() {
				return {
					id: null,
					form: {},
					//goods_category_tree: [],
				}
			},
			components: {
	
			},
			created() {
				//this.getGoodsCategoryTree();
	
				if (typeof(this.$route.params.id) != 'undefined') {
					//编辑
					this.id = this.$route.params.id;
					this.getCoupon();
				} else {
					//添加
				}
	
			},
			methods: {
				getCoupon() {
					var that = this;
					getStoreCoupon({
						id: that.id
					}).then(function(res) {
						that.form = res
					})
				}
			}
		}
</script>

<style scoped>

 
</style>
